package com.jahentao.testcase;


import java.util.List;

/**
 * 测试结果集
 * @author jahentao
 * @version 1.0
 * @updated 26-5月-2017 18:02:46
 */
public class TestResult {

	/**
	 * 测试总用例数
	 */
	private Integer caseCount;
	/**
	 * 未通过的测试用例集合
	 */
	private List<TestCase> notPassTestCases;
	/**
	 * 通过的用例数
	 */
	private Integer passCount;
	/**
	 * 测试通过率
	 */
	private Float testPassRate;

	public TestResult(){

	}

	/**
	 * 
	 * @param caseCount    用例总数
	 */
	public TestResult(Integer caseCount){
		this.caseCount = caseCount;
	}

	/**
	 * 计算通过率
	 */
	public Float calcPassRate(){
	    return (float)passCount/caseCount;
	}

	public Integer getCaseCount(){
		return this.caseCount;
	}

	public List<TestCase> getNotPassTestCases(){
		return this.notPassTestCases;
	}

	public Integer getPassCount(){
		return passCount;
	}

	public Float getTestPassRate(){
		return testPassRate==null?testPassRate:(testPassRate=calcPassRate());
	}
	public void setCaseCount(Integer caseCount){
	    this.caseCount = caseCount;
	}
	public void setPassCount(Integer passCount){
		this.passCount=passCount;
	}

}